<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui">

	<h:head><h1>Carrello</h1>
	
					<link type="text/css" href="../generalstyle.css" rel="stylesheet"/>
	
		 <style type="text/css">
        .ui-layout-unit{
             border: none;
        }
    </style>
	
	</h:head>
<body>
	<img src="http://www2.caravella.eu/wp-content/uploads/2012/06/carrello.gif" alt="" height="200" width="300"/>
	 <h:form>
        <p:menubar>  
                <p:menuitem value="Home" url="../home.xhtml" />  
				<p:menuitem value="Area Cliente" url="../cliente/homeCliente.xhtml" />
				<p:menuitem value="Area Impiegato" url="../impiegato/homeImpiegato.xhtml" /> 
				<p:menuitem value="Login" url="../login.xhtml" rendered="#{request.remoteUser == null}" />
                <p:menuitem value="Logout" actionListener="#{logoutManagedBean.logout()}" rendered="#{request.remoteUser != null}" />
		</p:menubar>
		</h:form>
    <ui:repeat value="#{CarrelloManagedBean.pacchetti}" var="packCorr" varStatus="statoPack">
        	<h:form>
        	   	<p:layout style=" height:200px;">
				<p:layoutUnit position="center">
				
					<p:layout style="height:50px;" >
						<p:layoutUnit position="west" size="200">
							<p:outputLabel value="Nome Pacchetto: " />
							<p></p>
							<p:outputLabel value="Numero Persone: " />
							<p></p>
							<p:outputLabel value="Data Partenza: " />
							<p></p>
							<p:outputLabel value="Data Ritorno: " />
							<p></p>
							<p:outputLabel value="Prezzo: " />
						</p:layoutUnit>
						
						<p:layoutUnit position="center">
							<p:outputLabel id="nome" value="#{packCorr.nome}" />
							<p></p>
							<p:outputLabel id="numeroPersone" value="#{packCorr.numeroPersone}"/>
							<p></p>
							<p:outputLabel id="dataPartenza" value="#{packCorr.dataPartenza}"/>
							<p></p>
							<p:outputLabel id="dataRitorno" value="#{packCorr.dataRitorno}"/>
							<p></p>
							<p:outputLabel id="Prezzo" value="#{packCorr.prezzo}"/>
						</p:layoutUnit>
					</p:layout>
					
				</p:layoutUnit>
				<p:layoutUnit position="east" size="600">
					<p:commandButton
						actionListener="#{CarrelloManagedBean.rimuoviPacchetto(CarrelloManagedBean.pacchetti.get(statoPack.index).idPacchetto)}"
						value="RIMUOVI" ajax="false"  />
				</p:layoutUnit>
			</p:layout>
        	</h:form>
    </ui:repeat>
 
    
    <h:form>
    	<p:button outcome="/cliente/pagamento.xhtml" value="CheckOut" rendered="#{!CarrelloManagedBean.pacchetti.isEmpty()}" />
    </h:form>

</body>
</html>